package com.lzs.system.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lzs.entity.LoginLog;
import com.lzs.entity.OperationLog;
import com.lzs.system.service.OperationLogService;
import com.lzs.util.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 操作日志 前端控制器
 * </p>
 *
 * @author ymw
 * @since 2020-12-09
 */
@RestController
@RequestMapping("/system/operationLog")
public class OperationLogController {
    @Autowired
    private OperationLogService operationLogService;
    @PostMapping("/selectOperaAll/{page}/{limit}")
    @ApiOperation(value = "条件查询所有业务日志")
    public Page<OperationLog> selectOperaAll(@PathVariable Integer page, @PathVariable Integer limit, @RequestBody Map map){
        Page<OperationLog> operationLogPage = operationLogService.selectOperaAll(page, limit, map);
        return operationLogPage;
    }
    @DeleteMapping("/deleteOpera")
    @ApiOperation(value = "清空所有业务日志")
    public R deleteOpera(){
        boolean b = operationLogService.remove(null);
        if (b){
            return R.ok().message("清空成功");
        }else {
            return R.error().message("清空失败");
        }
    }
}

